<?php

class Application_Form_codigo extends Zend_Form
{
    public function init()
    {
        $this->setName('codigo');

        $nome = new Zend_Form_Element_Text('nome');
        $nome->setLabel('Nome')
               ->setRequired(true)
               ->addFilter('StripTags')
               ->addFilter('StringTrim')
               ->addValidator('NotEmpty');

        $cpf = new Zend_Form_Element_Text('cpf');
        $cpf->setLabel('CPF')
              ->setRequired(true)
              ->addFilter('StripTags')
              ->addFilter('StringTrim')
              ->addValidator('NotEmpty');
              
        $chave = new Zend_Form_Element_Text('chave');
        $chave->setLabel('Codigo')
              ->setRequired(true)
              ->addFilter('StripTags')
              ->addFilter('StringTrim')
              ->addValidator('NotEmpty')
              ->setAttrib('size',10)
              ->setAttrib('maxLength',10);
        
       $hard = new Zend_Controller_Action_Helper_GenerateRandom();
        
        $chave->setValue($hard->hardPassword($length = 8));
        

        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setAttrib('id', 'submitbutton')
               ->setLabel('cadastrar');
        $this->addElements(array($nome, $cpf,$chave, $submit));
      }
      
}